package com.dengyuanke.upms.domain.dto;

import com.dengyuanke.upms.domain.entity.Menu;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author lengleng
 * @date 2017年11月9日23:33:27
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MenuTree extends TreeNode {
	private String icon;
	private String name;
	private boolean spread = false;
	private String path;
	private String component;
	private String authority;
	private String redirect;
	private Boolean keepAlive;
	private String code;
	private Integer type;
	private String label;
	private Integer sort;

	public MenuTree() {
	}

	public MenuTree(Long id, String name, Long parentId) {
		this.id = id;
		this.parentId = parentId;
		this.name = name;
		this.label = name;
	}

	public MenuTree(Long id, String name, MenuTree parent) {
		this.id = id;
		this.parentId = parent.getId();
		this.name = name;
		this.label = name;
	}

	public MenuTree(Menu menu) {
		this.id = menu.getId();
		this.parentId = menu.getParentId();
		this.icon = menu.getIcon();
		this.name = menu.getName();
		this.path = menu.getPath();
		this.component = menu.getComponent();
		this.type = menu.getType();
		this.label = menu.getName();
		this.sort = menu.getSort();
		this.keepAlive = menu.getKeepAlive();
	}

}
